package com.otherTest.designpattern.creationalpattern.abstractfactory;

import com.otherTest.designpattern.creationalpattern.abstractfactory.phonecolor.PhoneColorFactory;
import com.otherTest.designpattern.creationalpattern.abstractfactory.phoneversion.PhoneVersionFactory;

import java.util.Objects;

/**
 * @Description: 工厂生产者
 * @author: conceit
 * @Date: 2018/8/31 11:32
 */
public class PhoneFactoryProducer {

    public static PhoneAbstractFactory selectFactory(String factoryName) {
        if (Objects.isNull(factoryName)) {
            return null;
        } else if ("color".equalsIgnoreCase(factoryName)) {
            return new PhoneColorFactory();
        } else if ("version".equalsIgnoreCase(factoryName)) {
            return new PhoneVersionFactory();
        }
        return null;
    }

}
